#-*- coding: iso-8859-1 -*-
# tiedosto jamk.py

import sys
import struct

F = sys.stdin

Header = F.read(14)
if not Header[0:2] == "BM":
        print "Not a BMP file"
        sys.exit()

BitmapSize = struct.unpack('<i', Header[2:6])[0]
StartOffset = struct.unpack('<i', Header[10:14])[0]
print Header, " is the header of the file"
print StartOffset, " is the starting address of the bitmap."
print BitmapSize, " is the size of the bitmap"

OtherHeaders = F.read(StartOffset - 14)
print "Reading other headers... done"

Bitmap = F.read(BitmapSize - StartOffset)
print "Reading bitmap contents... done"
